<%@page import="com.wframe.project.jnd.rest.util.WebSession"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!-- 加载系统配置信息 -->
<s:syspro/>
<s:datas/>
<%if(WebSession.checkLoginStatus(session)){ %>
<div id="wrap-site">
	<div class="site-nav wid990">
		<div class="fl"><%=WebSession.getWbUser(session).getComname() %></div>
		<div class="fl padd-l-15"><%=WebSession.getWbUser(session).getComname()==null?"（未认证企业名称）":WebSession.getWbUser(session).getComname()%></div>
		<div class="fl padd-l-15"><a href="javascript:loginout();" class="curColor">退出</a></div>
		<ul class="site-nav-r fr">
			<li><a href="javascript:;">微信商城</a></li>
			<li><a href="${webctx}/user/home.jsp">会员中心</a></li>
			<li><a href="javascript:showmyorders();">我的订单</a></li>
			<li><a href="javascript;;">常购清单</a></li>
			<!-- <li><a href="javascript:addFavorite();">收藏本站</a></li> -->
			<li><div class="kf">
					<em class="curColor">客服：${syspro.fuwu_phone }</em>
				</div></li>
		</ul>
	</div>
</div>
<%}else{%>
<div id="wrap-site">
	<div class="site-nav wid990">
		<div class="fl">欢迎来到${webname }！</div>
		<ul class="site-nav-r fr">
			<li><a href="javascript:showloginpage();">登录</a></li>
			<li><a href="javascript:showregisterpage();">注册</a></li>
			<li><a href="javascript:showmyorders();">我的订单</a></li>
			<li><a href="${ctx }/order/oftenList">快捷下单</a></li>
			<!-- <li><a href="javascript:addFavorite();">收藏本站</a></li> -->
			<li><div class="kf">
					客服：<em class="curColor">${syspro.fuwu_phone }</em>
				</div></li>
		</ul>
	</div>
</div>
<%} %>
<c:forEach items="${ad_list}" var="ad_item" varStatus="status" >
	<c:set var="ad_head_info" value="${ad_item.dataMap}"></c:set>
	<c:if test="${ad_head_info.title=='head'||ad_head_info.title=='HEAD'||ad_head_info.title=='Head'}">
		<div style="width: 100%;overflow: hidden;">
			<div style="width: 4100%;margin-left: -2000%;text-align: center;">
				<a href="${ad_head_info.url}" target="_blank">
					<img src="${fileserver }${ad_head_info.phototitle}">
				</a>
			</div>
		</div>
	</c:if>
</c:forEach>
<script>
function showloginpage(tourl){
	var curUrl="";
	if(tourl)curUrl=tourl;
	else curUrl=window.location.href;
	sessionStorage.setItem("_curUrl_",curUrl);
	window.location.href=loginUrl;
}
function showregisterpage(){
	window.location.href=server+"/user/showregister";
}
function showusercenter(){
	if($w.checkLogin(true,server+"/user/home")){
		window.location.href=server+"/user/home";
	}
}
function showshopcart(){
	window.location.href=server+"/order/shopcart";
}
function showmyorders(){
	window.location.href=server+"/order/orderlist";
}
function loginout(){
	$w.clearLoginUser();
	$w.httpRequest({
		 url:server+"/user/loginout",
		 data:{},
		 ok:function(ret){
			 window.location.href=ctx+"/index/home";
		 }
	 })
}
function addFavorite() {
    var url = window.location;
    var title = document.title;
    try {
        window.external.addFavorite(url, title);
    }catch (e) {
       try {
         window.sidebar.addPanel(title, url, "");
      }catch (e) {
           alert("抱歉，您所使用的浏览器无法完成此操作。\n\n加入收藏失败，请使用Ctrl+D进行添加");
		}
    }
}
function loadMaylike(size,fun,pno){
	var priceid=getBrowsepriceid();
	var url=apiroot+'/product/maylike?priceid='+priceid+"&pagesize="+size;
	if(pno)url+="&pageno="+pno;
	$w.httpRequest({
		 url:url,
		 data:{},
		 ok:function(ret){
			 fun(ret.Data);
		 }
	 })
}
//$(function () {
//	$w.httpRequest({
//        url:"/info/advertise",
//        method:"GET",
//		async:"false",
//		data:{"code":"003201"},
//		ok:function (ret) {
//            var list = ret.Data;
//            var str='';
//            for(var i=0; i < list.length; i++){
//           	str +='<div style="width: 100%;overflow: hidden;">'
//            str +='<div style="width: 4100%;margin-left: -2000%;text-align: center;">'
//            str +='<a href="#"><img src="list[i]"></a>'
//            str +='</div>'
//            str +='</div>'
//			}
//        }
//	})
//})
</script>